def wordPattern(pattern: str, s: str) -> bool:
    if pattern == "" and s =="":
        return True
    

    hashmap_1 = {}
    hashmap_2 = {}

    pattern = list(pattern)
    s = list(s.split(" "))
    for i in range(len(pattern)):
        if pattern[i] not in hashmap_1:
            hashmap_1[pattern[i]] = s[i]

        if s[i] not in hashmap_2:
            hashmap_2[s[i]] = pattern[i]

        if hashmap_1[pattern[i]] != s[i] or hashmap_2[s[i]] != pattern[i]:
            
            return False
    return True

print(wordPattern("abba","cc bb bb aa"))